-- @owner: @zhanghuan96
-- @date: 2024/9/18
-- @testpoint: rownum作为函数名
@conn PrimaryDbDmode;
--step1:建表;expect:成功
drop table if exists t_rownum_0007;
create table t_rownum_0007(cid int);

--step2:rownum作为函数名;expect:成功
drop function if exists rownum;
create function rownum(card_id int) returns char(50) as
$$
declare num int := 0;
begin
while num<=card_id loop
insert into t_rownum_0007 values(num);
num := num+1;
end loop;
return card_id;
end;
$$ language plpgsql;
/
--step3:调用函数;expect:成功
select rownum(3);
select * from t_rownum_0007;

--step4:清理环境;expect:成功
drop function if exists rownum;
drop table if exists t_rownum_0007;
